/**
 * Created by gim on 14-2-5.
 */
var assert = require("assert");
var mpl = require('../lib/model.js');
var path = require('path');
var db = require('./db/config.js').db;

describe(' loadFolder ', function () {

    it(' lazy loading  ', function (done) {
        mpl.loadFolder(path.join(__dirname, 'model'), {db: db, lazy: true});
        assert.equal(typeof EagerUser, 'undefined');
        mpl.loadModel('EagerUser');
        assert.equal(typeof EagerUser, 'function');
        done();
    });

    it(' eager loading ', function (done) {
        //global._modelPaths = undefined;
        mpl.loadFolder(path.join(__dirname, 'model'), {db: db});
        assert.equal(typeof EagerUser, 'function');
        done();
    });

});
